package com.dongrj.framework.starter.log.dingding;

import com.dongrj.framework.starter.log.dingding.chain.*;
import lombok.extern.slf4j.Slf4j;


/**
 * @author dongrongjun
 * @date 2020/4/2
 */
@Slf4j
public class AppStatusDingDingSender implements Send<DingTalkMsg> {

    private static volatile AppStatusDingDingSender instance;

    private AbstractRobot head;

    private AppStatusDingDingSender() {
        head = new AppAlertRobot();
        head.next(new AttendanceRobot()).next(new JiaLiuRobot()).next(new WeekendRobot());
    }

    @Override
    public void send(DingTalkMsg dingDing) {
        head.send(dingDing);
    }

    public static AppStatusDingDingSender getInstance() {
        if (instance == null) {
            synchronized (AppStatusDingDingSender.class) {
                if (instance == null) {
                    instance = new AppStatusDingDingSender();
                }
            }
        }
        return instance;
    }
}
